package br.ufpe.cin.mac.middleware.autonomic.monitors;

import java.io.IOException;
import java.lang.management.ManagementFactory;

import javax.management.MBeanServerConnection;

public class JMXUtil {

	public static com.sun.management.OperatingSystemMXBean osMBean;

	public static com.sun.management.OperatingSystemMXBean getOsMBean()
			throws IOException {
		if (osMBean == null) {
			MBeanServerConnection mbsc = ManagementFactory
					.getPlatformMBeanServer();
			osMBean = ManagementFactory.newPlatformMXBeanProxy(mbsc,
					ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
					com.sun.management.OperatingSystemMXBean.class);
		}
		return osMBean;

	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {

	}

}
